package com.vben.ai.controller;

import com.vben.ai.service.ImageService;
import com.vben.common.core.util.R;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/image")
public class ImageController {

    @Resource
    private ImageService imageService;

    /**
     * 文生图
     */
    @GetMapping
    public R<String> image(@RequestParam(value = "prompt", defaultValue = "生成一张雪豹做着滑稽动作的图片") String prompt) {
        return R.ok(imageService.image(prompt));
    }
}
